// 这里有个例子
// 错误示范在 f55b4c74
struct Parent {
    count: u32,
}

struct Child<'a> {
    parent: &'a Parent,
}

struct Combined<'a> {
    parent: Parent,
    child: Child<'a>,
}

impl Parent {
    fn child<'a>(&'a self) -> Child<'a> {
        Child { parent: &self }
    }
}

// impl<'a> Combined<'a> {
//     fn new() -> Combined<'a> {
//         // Combined { parent, child }
//     }
// }

// 创建一个引用自身的类型
#[derive(Debug)]
struct WhatAboutThis<'a> {
    name: String,
    nickname: Option<&'a str>,
}

fn main() {
    let mut tricky = WhatAboutThis {
        name: "Annabelle".to_string(),
        nickname: None,
    };
    tricky.nickname = Some(&tricky.name[..4]);


}
